package com.easy.facilitaterecycleadapter.decoration;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.easy.facilitaterecycleadapter.R;

import java.util.List;

/**
 * Created by Sigthp-P-Department on 2018/5/4.
 */

public class DecorationAdapter extends RecyclerView.Adapter<DecorationAdapter.ViewHolder> {
    private List<Integer> mList;
    private Context mContext;
    public DecorationAdapter(Context context, List<Integer> list){
        mList=list;
        mContext=context.getApplicationContext();
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = View.inflate(mContext, R.layout.base_item_layout, null);
        ViewHolder viewHolder=new ViewHolder(view);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        holder.mTvNumber.setText(mList.get(position)+"");
    }

    @Override
    public int getItemCount() {
        return mList.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder{

        private  TextView mTvNumber;

        public ViewHolder(View itemView) {
            super(itemView);
            mTvNumber = itemView.findViewById(R.id.tv_number);
        }
    }
}
